<template>
  <div v-if="async">
    <el-tabs v-model="viewModel" class="demo-tabs" @tab-click="handleClick">
      <el-tab-pane :label="mItem.name" :name="mItem.type" v-for="(mItem,mIndex) in tabsList" :key="mIndex">
        <div class="demo-tabs_cont" :class="{'demo-tabs_border': tabPaneIndex == mIndex}" @mouseenter="tabPanefunc(mItem,mIndex)" @mouseleave="handleLeave"></div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  model: {
    prop: 'dataModel',
    event: 'change'
  },
  props: {
    widget: {},
    dataModel: {},
    size: {}
  },
  data() {
    return {
      async: false,
      viewModel: 'basic',
      tabsList: [
        { name: '基本信息', type: 'basic', fields: [] },
        { name: '高级选项', type: 'advanced', fields: [] }
      ]
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    async init() {        
      if (this.dataModel) {
        this.viewModel = this.dataModel        
      }
      this.async = true
    }
  }
}
</script>